O(1) Time Generation of Adjacent Multiset Combinations
نویسنده
چکیده
We solve the problem of designing an O(1) time algorithm for generating adjacent multiset combinations in a different approach from Walsh [17]. By the word “adjacent”, we mean that two adjacent multiset combinations are different at two places by one in their vector forms. Previous O(1) time algorithms for multiset combinations generated non-adjacent multiset combinations. Our algorithm in this paper can be derived from a general framework of combinatorial Gray code, which we characterise to suit our need for combinations and multiset combinations. The central idea is a twisted lexico tree, which is obtained from the lexicographic tree for the given set of combinatorial objects by twisting branches depending on the parity of each node. An iterative algorithm which traverses this tree will generate the given set of combinatorial objects in constant time as well as with a fixed number of changes from the present combinatorial object to the next.
منابع مشابه
Multi-level Loop-less Algorithm for Multi-set Permutations
We present an algorithm that generates multiset permutations in O(1) time for each permutation, that is, by a loop-less algorithm with O(n) extra memory requirement. There already exist several such algorithms that generate multiset permutations in various orders. For multiset permutations, we combine two loop-less algorithms that are designed in the same principle of tree traversal. Our order ...
متن کاملA Gray Code for Combinations of a Multiset
Let C k n n nt denote the set of all k element combinations of the multiset consisting of ni occurrences of i for i t Each combination is itself a multiset For example C ff g f g f g f gg We show that multiset combinations can be listed so that successive combina tions di er by one element Multiset combinations simultaneously generalize for which minimal change listings called Gray codes are kn...
متن کاملMultiset Permutations in Lexicographic Order
In a previous work [12], we proposed a method for generating permutations in lexicographic order. In this study, we extend it to generate multiset permutations. A multiset is a collection of items that are not necessarily distinct. The guideline of the extension is to skip, as soon as possible, those partially-formed permutations that are less than or equal to the latest generated eligible perm...
متن کاملShift Gray Codes
Combinatorial objects can be represented by strings, such as 21534 for the permutation (1 2) (3 5 4), or 110100 for the binary tree corresponding to the balanced parentheses (()()). Given a string s = s1s2⋯sn, the right-shift operation ÐÐ→ shift(s, i, j) replaces the substring sisi+1⋯sj by si+1⋯sjsi. In other words, si is right-shifted into position j by applying the permutation (j j−1 ⋯ i) to ...
متن کاملAn O(1) Time Algorithm for Generating Multiset Permutations
We design an algorithm that generates multiset permutations in O(1) time from permutation to permutations, using only data structures of arrays. The previous O(1) time algorithm used pointers, causing O(n) time to access an element in a permutation, where n is the size of permutations. The central idea in our algorithm is tree traversal. We associate permutations with the leaves of a tree. By t...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- CoRR
دوره abs/1503.00067 شماره
صفحات -
تاریخ انتشار 2015